//for hooking into any document
//var injectedScriptCount = 0;
var scriptsLoadedCallback = null;

function Initialize2()
{
	
	Initialize();
}

window.onload = function()
{
	AllLoadedCallback.callback=Initialize2;
	InjectScript('js/jquery-1.3.2.js', AllLoadedCallback);
	InjectScript('js/2.js', AllLoadedCallback);
	InjectScript('js/jquery.flydom-3.1.1.js', AllLoadedCallback);
	scriptsLoadedCallback = Initialize2;
}



var AllLoadedCallback=new function()
{
	this.injectedScriptCount=0;
	this.callback=null;
	this.Loaded=function()
	{
		//alert(AllLoadedCallback.injectedScriptCount)
		AllLoadedCallback.injectedScriptCount--;
		if (AllLoadedCallback.injectedScriptCount == 0)
		{
			
			if(AllLoadedCallback.callback!=null)
			{
				AllLoadedCallback.callback();
			}
		}
	}
}






function xAllLoadedCallback()
{
	injectedScriptCount--;
	if (injectedScriptCount == 0)
	{
		try
		{
			scriptsLoadedCallback();
		} 
		catch (e)
		{
		}
	}
}


function InjectScript(src, callback)
{
	
	callback.injectedScriptCount++
	script = document.createElement("SCRIPT");
	script.src = src;
	if (callback != null)
	{
		if (script.attachEvent){
			script.attachEvent('onreadystatechange', callback.Loaded);
		}
		else{
			script.addEventListener('load', callback.Loaded, true);
		}
	}
	document.getElementsByTagName('HEAD')[0].appendChild(script);
}

